<!DOCTYPE html>
<html lang="zh-CN" class="loading">

<head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <title>STM32学习笔记(2)通用计时器 - Skyone-Blog</title>
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
    <meta name="google" content="notranslate" />
    <meta name="keywords" content="技术博客,Python,Android,Arduino,JavaScript,Linux,Node.js,"> 
    <meta name="description" content="Skyone技术博客,记录STM32学习历程，本文介绍了如何配置、使用定时器，以及产生定时器中断"> 
    <meta name="author" content="王志伟"> 
    <link rel="alternative" href="atom.xml" title="Skyone-Blog" type="application/atom+xml"> 
    <link rel="icon" href="/img/favicon.png"> 
    
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.css">

    
<link rel="stylesheet" href="/css/diaspora.css">

    <!-- 看板娘
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/font-awesome/css/font-awesome.min.css">
    <script src="/live2d-widget/autoload.js"></script>
    -->
    <!-- MD5 -->
    <script src="/js/md5.min.js"></script>
    <!-- MathJax -->
    
        <script type="text/x-mathjax-config">
        (function () {
            let target = document.getElementsByClassName("content")[0];
            MathJax.Hub.Config({
                tex2jax: {
                    inlineMath:  [ ["$", "$"] ],
                    displayMath: [ ["$$","$$"] ],
                    skipTags: ['script', 'noscript', 'style', 'textarea', 'pre','code','a'],
                    ignoreClass:"class1"
                }
            });
            MathJax.Hub.Queue(["Typeset",MathJax.Hub,target]);
        })();
    </script>
<script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>

    
<meta name="generator" content="Hexo 5.3.0"></head>

<body class="loading">
    <span id="config-title" style="display:none">Skyone-Blog</span>
    <div id="loader"></div>
    <div id="single">
    <div id="top" style="display: block;">
    <div class="bar" style="width: 0;"></div>
    <a class="iconfont icon-home image-icon" href="javascript:;" data-url="https://www.skyone.host"></a>
    <div title="播放/暂停" class="iconfont icon-play"></div>
    <h3 class="subtitle">STM32学习笔记(2)通用计时器</h3>
    <div class="social">
        <div>
            <div class="share">
                <a title="获取二维码" class="iconfont icon-scan" href="javascript:;"></a>
            </div>
            <div id="qr"></div>
        </div>
    </div>
    <div class="scrollbar"></div>
</div>

    <div class="section">
        <div class="article">
    <div class='main'>
        <h1 class="title">STM32学习笔记(2)通用计时器</h1>
        <div class="stuff">
            <span>六月 25, 2021</span>
            
  <ul class="post-tags-list" itemprop="keywords"><li class="post-tags-list-item"><a class="post-tags-list-link" href="/tags/STM32/" rel="tag">STM32</a></li></ul>


        </div>
        <div class="content markdown">
            <p><strong>本文章适用于STM32F103RBT6</strong>，其他型号可能有所不同</p>
<p>开发模板见我的GitHub仓库<a target="_blank" rel="noopener" href="https://github.com/skyone-wzw/STM32F103RBT6-template.git">skyone-wzw@STM32F103RBT6-template</a></p>
<p>如果你觉得这篇文章有帮助，请star仓库或评论回复吧~</p>
<p>如果文章有任何错误（包括错别字）可以在<a target="_blank" rel="noopener" href="https://github.com/skyone-wzw/blog/issues">这里</a>提交Issue或<a href="mailto:wzw@skyone.host">邮件</a>联系我</p>
<h2 id="使能定时器时钟"><a href="#使能定时器时钟" class="headerlink" title="使能定时器时钟"></a>使能定时器时钟</h2><p><code>RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIMx, ENABLE);</code></p>
<p>使能定时器时钟，对于中容量STM32F103，TIMx可以是：</p>
<ul>
<li><code>TIM1</code>：高级定时器</li>
<li><code>TIM2</code>~`TIM4`通用定时器</li>
</ul>
<p>例如</p>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM3, ENABLE);</span><br><span class="line"><span class="comment">// 使能通用定时器3</span></span><br></pre></td></tr></table></figure>
<h2 id="初始化定时器"><a href="#初始化定时器" class="headerlink" title="初始化定时器"></a>初始化定时器</h2><p><code>TIM_TimeBaseInit(TIMx, &amp;TIM_TimeBaseInitTypeDef)</code></p>
<p>定义计时器的重装载值、预分频系数、计数方式等</p>
<p>对于<code>TIM_TimeBaseInitTypeDef</code>结构体</p>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">typedef</span> <span class="class"><span class="keyword">struct</span> &#123;</span></span><br><span class="line">	<span class="keyword">uint16_t</span> TIM_Prescaler;</span><br><span class="line">    <span class="comment">// 预分频系数，下面有解释</span></span><br><span class="line">	<span class="keyword">uint16_t</span> TIM_CounterMode;</span><br><span class="line">    <span class="comment">/* 计数方式，可以是</span></span><br><span class="line"><span class="comment">     * 		向上计数: `TIM_CounterMode_Up`</span></span><br><span class="line"><span class="comment">     * 		向下计数: `TIM_CounterMode_Down`</span></span><br><span class="line"><span class="comment">     * 		中心计数: `TIM_CounterMode_CenterAligned1`</span></span><br><span class="line"><span class="comment">     *			   | `TIM_CounterMode_CenterAligned2`</span></span><br><span class="line"><span class="comment">     *			   | `TIM_CounterMode_CenterAligned3`</span></span><br><span class="line"><span class="comment">     */</span></span><br><span class="line">	<span class="keyword">uint16_t</span> TIM_Period;</span><br><span class="line">    <span class="comment">// 重装载值，即tick的次数</span></span><br><span class="line">    </span><br><span class="line">    <span class="comment">// TODO 下面两个暂时不理解，待更新</span></span><br><span class="line">	<span class="keyword">uint16_t</span> TIM_ClockDivision;</span><br><span class="line">	<span class="keyword">uint8_t</span> TIM_RepetitionCounter;</span><br><span class="line">&#125; TIM_TimeBaseInitTypeDef;</span><br></pre></td></tr></table></figure>
<p>例如：</p>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line">TIM_TimeBaseInitTypeDef tim3;</span><br><span class="line">tim3.TIM_Period = <span class="number">4999</span>;</span><br><span class="line"><span class="comment">// 重装载值为 4999, tick 5000 次</span></span><br><span class="line">tim3.TIM_Prescaler = <span class="number">7199</span>;</span><br><span class="line"><span class="comment">// 预分频系数为 7200 = 7199 + 1</span></span><br><span class="line"><span class="comment">// 系统时钟为72MHz, TIM3 的时钟为 72000000 / 2 * 2 / 7200 = 10kHz</span></span><br><span class="line"><span class="comment">// 即一次 0.1ms</span></span><br><span class="line">tim3.TIM_CounterMode = TIM_CounterMode_Up;</span><br><span class="line">tim3.TIM_ClockDivision = TIM_CKD_DIV1;</span><br><span class="line">TIM_TimeBaseInit(TIM3, &amp;tim3);</span><br></pre></td></tr></table></figure>
<h2 id="开启定时器中断"><a href="#开启定时器中断" class="headerlink" title="开启定时器中断"></a>开启定时器中断</h2><p><code>TIM_ITConfig(TIMx, TIM_IT, ENABLE);</code></p>
<p>设置什么情况下中断，可以为：</p>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">#<span class="meta-keyword">define</span> TIM_IT_Update                      ((uint16_t)0x0001)</span></span><br><span class="line"><span class="comment">// 更新中断</span></span><br><span class="line"><span class="meta">#<span class="meta-keyword">define</span> TIM_IT_CC1                         ((uint16_t)0x0002)</span></span><br><span class="line"><span class="meta">#<span class="meta-keyword">define</span> TIM_IT_CC2                         ((uint16_t)0x0004)</span></span><br><span class="line"><span class="meta">#<span class="meta-keyword">define</span> TIM_IT_CC3                         ((uint16_t)0x0008)</span></span><br><span class="line"><span class="meta">#<span class="meta-keyword">define</span> TIM_IT_CC4                         ((uint16_t)0x0010)</span></span><br><span class="line"><span class="meta">#<span class="meta-keyword">define</span> TIM_IT_COM                         ((uint16_t)0x0020)</span></span><br><span class="line"><span class="meta">#<span class="meta-keyword">define</span> TIM_IT_Trigger                     ((uint16_t)0x0040)</span></span><br><span class="line"><span class="meta">#<span class="meta-keyword">define</span> TIM_IT_Break                       ((uint16_t)0x0080)</span></span><br></pre></td></tr></table></figure>
<p>当然，用到中断就要设置中断优先级，此外，不要忘记在main函数开始时设置中断优先级分组</p>
<h2 id="使能定时器"><a href="#使能定时器" class="headerlink" title="使能定时器"></a>使能定时器</h2><p><code>TIM_Cmd(TIMx, ENABLE);</code></p>
<p>非常简单，无需解释</p>
<h2 id="写中断服务函数"><a href="#写中断服务函数" class="headerlink" title="写中断服务函数"></a>写中断服务函数</h2><p>对于高级定时器，中断服务函数的名字为：</p>
<ul>
<li><code>void TIMx_BRK_IRQHandler()</code></li>
<li><code>void TIMx_UP_IRQHandler()</code></li>
<li><code>void TIMx_TRG_COM_IRQHandler()</code></li>
<li><code>void TIMx_CC_IRQHandler()</code></li>
</ul>
<p>对于通用定时器，中断服务函数的名字为：</p>
<ul>
<li><code>void TIMx_IRQHandler()</code></li>
</ul>
<p><strong><code>TIMx</code>中的<code>x</code>换成对应计时器ID</strong></p>
<h2 id="例程"><a href="#例程" class="headerlink" title="例程"></a>例程</h2><p>下面给出一个完整的例子</p>
<ul>
<li><code>main.c</code></li>
</ul>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">#<span class="meta-keyword">include</span> <span class="meta-string">&lt;stm32f10x.h&gt;</span></span></span><br><span class="line"><span class="meta">#<span class="meta-keyword">include</span> <span class="meta-string">&lt;system_stm32f10x.h&gt;</span></span></span><br><span class="line"></span><br><span class="line"><span class="function"><span class="keyword">void</span> <span class="title">TIM3_IRQHandler</span><span class="params">()</span> </span>&#123;</span><br><span class="line">    <span class="keyword">if</span> (TIM_GetFlagStatus(TIM3, TIM_FLAG_Update) == SET) &#123;</span><br><span class="line">        <span class="comment">// 判断发生了 `TIM_FLAG_Update` 中断</span></span><br><span class="line">        <span class="comment">// 翻转LED状态</span></span><br><span class="line">        <span class="keyword">if</span> (GPIO_ReadOutputDataBit(GPIOC, GPIO_Pin_0) == <span class="number">1</span>) &#123;</span><br><span class="line">            GPIO_ResetBits(GPIOC, GPIO_Pin_0);</span><br><span class="line">        &#125; <span class="keyword">else</span> &#123;</span><br><span class="line">            GPIO_SetBits(GPIOC, GPIO_Pin_0);</span><br><span class="line">        &#125;</span><br><span class="line">        <span class="comment">// 取消中断标志位</span></span><br><span class="line">        TIM_ClearITPendingBit(TIM3, TIM_FLAG_Update);</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="function"><span class="keyword">int</span> <span class="title">main</span><span class="params">()</span> </span>&#123;</span><br><span class="line">    SetSysClock();</span><br><span class="line">    <span class="comment">// 初始化系统时钟为 72MHz</span></span><br><span class="line">    NVIC_SetPriorityGrouping(NVIC_PriorityGroup_2);</span><br><span class="line">    <span class="comment">// 中断优先级分组为 2</span></span><br><span class="line"></span><br><span class="line">    <span class="comment">/*</span></span><br><span class="line"><span class="comment">     * 初始化通用计时器3</span></span><br><span class="line"><span class="comment">     * init_tim3 &#123;</span></span><br><span class="line"><span class="comment">     */</span></span><br><span class="line">    RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM3, ENABLE);</span><br><span class="line">    <span class="comment">// 使能通用计时器 3</span></span><br><span class="line"></span><br><span class="line">    TIM_TimeBaseInitTypeDef tim3;</span><br><span class="line">    tim3.TIM_Period = <span class="number">4999</span>;</span><br><span class="line">    <span class="comment">// 重装载值为 4999, tick 5000 次</span></span><br><span class="line">    tim3.TIM_Prescaler = <span class="number">7199</span>;</span><br><span class="line">    <span class="comment">// 预分频系数为 7200</span></span><br><span class="line">    <span class="comment">// 系统时钟为72MHz, TIM3 的时钟为 72000000 / 2 * 2 / 7200 = 10kHz</span></span><br><span class="line">    <span class="comment">// 即一次 0.1ms</span></span><br><span class="line">    tim3.TIM_CounterMode = TIM_CounterMode_Up;</span><br><span class="line">    tim3.TIM_ClockDivision = TIM_CKD_DIV1;</span><br><span class="line">    TIM_TimeBaseInit(TIM3, &amp;tim3);</span><br><span class="line"></span><br><span class="line">    TIM_ITConfig(TIM3, TIM_IT_Update, ENABLE);</span><br><span class="line">    <span class="comment">// 配置更新中断</span></span><br><span class="line"></span><br><span class="line">    NVIC_InitTypeDef nvic_tim3;</span><br><span class="line">    nvic_tim3.NVIC_IRQChannel = TIM3_IRQn;</span><br><span class="line">    nvic_tim3.NVIC_IRQChannelPreemptionPriority = <span class="number">2</span>;</span><br><span class="line">    nvic_tim3.NVIC_IRQChannelSubPriority = <span class="number">2</span>;</span><br><span class="line">    nvic_tim3.NVIC_IRQChannelCmd = ENABLE;</span><br><span class="line">    NVIC_Init(&amp;nvic_tim3);</span><br><span class="line">    <span class="comment">// 设置中断优先级</span></span><br><span class="line"></span><br><span class="line">    TIM_Cmd(TIM3, ENABLE);</span><br><span class="line">    <span class="comment">// 使能定时器</span></span><br><span class="line">    <span class="comment">/* </span></span><br><span class="line"><span class="comment">     * 初始化通用计时器3</span></span><br><span class="line"><span class="comment">     * &#125;</span></span><br><span class="line"><span class="comment">     */</span></span><br><span class="line"></span><br><span class="line">    <span class="comment">/*</span></span><br><span class="line"><span class="comment">     * 初始化LED0</span></span><br><span class="line"><span class="comment">     * init_LED0 &#123;</span></span><br><span class="line"><span class="comment">     */</span></span><br><span class="line">    RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC, ENABLE);</span><br><span class="line">    GPIO_InitTypeDef led0;</span><br><span class="line">    led0.GPIO_Pin = GPIO_Pin_0;</span><br><span class="line">    led0.GPIO_Mode = GPIO_Mode_Out_PP;</span><br><span class="line">    led0.GPIO_Speed = GPIO_Speed_50MHz;</span><br><span class="line">    GPIO_Init(GPIOC, &amp;led0);</span><br><span class="line">    GPIO_ResetBits(GPIOC, GPIO_Pin_0);</span><br><span class="line">    <span class="comment">/*</span></span><br><span class="line"><span class="comment">     * 初始化LED0</span></span><br><span class="line"><span class="comment">     * &#125;</span></span><br><span class="line"><span class="comment">     */</span></span><br><span class="line"></span><br><span class="line">    <span class="keyword">for</span> (;;) &#123; &#125;</span><br><span class="line">&#125;</span><br><span class="line"></span><br></pre></td></tr></table></figure>
<p>没有附加依赖，使用定时器中断使LED闪烁，LED用的是<code>GPIOC_0</code></p>
<p>为了方便分享和复习，所有代码写在一个文件里，<strong>实际开发这样做非常不对！</strong></p>

            <!--[if lt IE 9]><script>document.createElement('audio');</script><![endif]-->
            <audio id="audio" loop="1" preload="auto" controls="controls" data-autoplay="false">
                <source type="audio/mpeg" src="">
            </audio>
            
                <ul id="audio-list" style="display:none">
                    
                        
                            <li title='0' data-url='https://tc.skyone.host/blog/music/%E6%B4%9B%E5%A4%A9%E4%BE%9D%20-%20%E5%A4%9C%E8%88%AA%E6%98%9F.flac'></li>
                        
                    
                        
                            <li title='1' data-url='https://tc.skyone.host/blog/music/%E6%B4%9B%E5%A4%A9%E4%BE%9D%20-%20%E8%8C%89%E8%8E%89%E8%8A%B1.mp3'></li>
                        
                    
                        
                            <li title='2' data-url='https://tc.skyone.host/blog/music/%E8%B5%A4%E7%BE%BD%20-%20%E4%B8%87%E5%8F%A4%E7%94%9F%E9%A6%99.flac'></li>
                        
                    
                        
                            <li title='3' data-url='https://tc.skyone.host/blog/music/%E6%B4%9B%E5%A4%A9%E4%BE%9D%20-%20%E4%B8%BA%E8%B0%81%E8%80%8C%E4%B8%BA.mp3'></li>
                        
                    
                        
                            <li title='4' data-url='https://tc.skyone.host/blog/music/%E4%B9%90%E6%AD%A3%E7%BB%AB%20-%20Faded.mp3'></li>
                        
                    
                        
                            <li title='5' data-url='https://tc.skyone.host/blog/music/bilibili2018%20-%20%E8%87%B3%E5%B0%8A%E9%A9%AC%E7%94%B2.flac'></li>
                        
                    
                </ul>
            
        </div>
        
    <div id='gitalk-container' class="comment link"
		data-enable='true'
        data-ae='true'
        data-ci='d5e197ef955b7f3268e5'
        data-cs='7d4feed7a179ad28943b0865b7970814073145ad'
        data-r='blog-gitalk'
        data-o='skyone-wzw'
        data-a='skyone-wzw'
        data-d='false'
    >查看评论</div>


    </div>
    
        <div class='side'>
			<ol class="toc"><li class="toc-item toc-level-2"><a class="toc-link" href="#%E4%BD%BF%E8%83%BD%E5%AE%9A%E6%97%B6%E5%99%A8%E6%97%B6%E9%92%9F"><span class="toc-number">1.</span> <span class="toc-text">使能定时器时钟</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%88%9D%E5%A7%8B%E5%8C%96%E5%AE%9A%E6%97%B6%E5%99%A8"><span class="toc-number">2.</span> <span class="toc-text">初始化定时器</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%BC%80%E5%90%AF%E5%AE%9A%E6%97%B6%E5%99%A8%E4%B8%AD%E6%96%AD"><span class="toc-number">3.</span> <span class="toc-text">开启定时器中断</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E4%BD%BF%E8%83%BD%E5%AE%9A%E6%97%B6%E5%99%A8"><span class="toc-number">4.</span> <span class="toc-text">使能定时器</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%86%99%E4%B8%AD%E6%96%AD%E6%9C%8D%E5%8A%A1%E5%87%BD%E6%95%B0"><span class="toc-number">5.</span> <span class="toc-text">写中断服务函数</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E4%BE%8B%E7%A8%8B"><span class="toc-number">6.</span> <span class="toc-text">例程</span></a></li></ol>	
        </div>
    
</div>


    </div>
</div>
</body>

<script src="//cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.min.js"></script>


<script src="//lib.baomitu.com/jquery/1.8.3/jquery.min.js"></script>
<script src="/js/plugin.js"></script>
<script src="/js/typed.js"></script>
<script src="/js/skyone.min.js"></script>


<link rel="stylesheet" href="/photoswipe/photoswipe.css">
<link rel="stylesheet" href="/photoswipe/default-skin/default-skin.css">


<script src="/photoswipe/photoswipe.min.js"></script>
<script src="/photoswipe/photoswipe-ui-default.min.js"></script>


<!-- Root element of PhotoSwipe. Must have class pswp. -->
<div class="pswp" tabindex="-1" role="dialog" aria-hidden="true">
    <!-- Background of PhotoSwipe. 
         It's a separate element as animating opacity is faster than rgba(). -->
    <div class="pswp__bg"></div>
    <!-- Slides wrapper with overflow:hidden. -->
    <div class="pswp__scroll-wrap">
        <!-- Container that holds slides. 
            PhotoSwipe keeps only 3 of them in the DOM to save memory.
            Don't modify these 3 pswp__item elements, data is added later on. -->
        <div class="pswp__container">
            <div class="pswp__item"></div>
            <div class="pswp__item"></div>
            <div class="pswp__item"></div>
        </div>
        <!-- Default (PhotoSwipeUI_Default) interface on top of sliding area. Can be changed. -->
        <div class="pswp__ui pswp__ui--hidden">
            <div class="pswp__top-bar">
                <!--  Controls are self-explanatory. Order can be changed. -->
                <div class="pswp__counter"></div>
                <button class="pswp__button pswp__button--close" title="Close (Esc)"></button>
                <button class="pswp__button pswp__button--share" title="Share"></button>
                <button class="pswp__button pswp__button--fs" title="Toggle fullscreen"></button>
                <button class="pswp__button pswp__button--zoom" title="Zoom in/out"></button>
                <!-- Preloader demo http://codepen.io/dimsemenov/pen/yyBWoR -->
                <!-- element will get class pswp__preloader--active when preloader is running -->
                <div class="pswp__preloader">
                    <div class="pswp__preloader__icn">
                      <div class="pswp__preloader__cut">
                        <div class="pswp__preloader__donut"></div>
                      </div>
                    </div>
                </div>
            </div>
            <div class="pswp__share-modal pswp__share-modal--hidden pswp__single-tap">
                <div class="pswp__share-tooltip"></div> 
            </div>
            <button class="pswp__button pswp__button--arrow--left" title="Previous (arrow left)">
            </button>
            <button class="pswp__button pswp__button--arrow--right" title="Next (arrow right)">
            </button>
            <div class="pswp__caption">
                <div class="pswp__caption__center"></div>
            </div>
        </div>
    </div>
</div>




</html>
